﻿using CarPCBATest.Procedure;
using CarPCBATest.ViewModel;
using System.Windows;
using System.Windows.Controls;

namespace CarPCBATest.View
{
    /// <summary>
    /// LampTestView.xaml 的交互逻辑
    /// </summary>
    public partial class LampTestView : UserControl
    {
        public LampTestView()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            int x = int.Parse((sender as Button).CommandParameter.ToString());

            switch (x)
            {
                case 0:
                //Global.CANfd = new S12L_LedA();
                //Global.CANfd.Init();
                //break;

                case 1:

                    Global.CANfd.StartSendCmd();
                    Global.CANfd.StopLedLightness = int.Parse(tbStopLightnesss.Text);
                    Global.CANfd.TurnLeftLedLightness = int.Parse(tbTurnLeftLightnesss.Text);
                    Global.CANfd.TurnRightLedLightness = int.Parse(tbTurnRightLightnesss.Text);
                    break;

                case 2:
                    //Global.CANfd.Close();
                    break;

                case 3:
                    break;

                case 4: // B灯 Right
                    //Global.CANfd = new S12L_LedB();
                    //Global.CANfd.Init();
                    break;

                case 5: // B灯 Left
                    Global.CANfd.StopLedLightness = int.Parse(tbStopLightnesss.Text);
                    Global.CANfd.TurnLeftLedLightness = int.Parse(tbTurnLeftLightnesss.Text);
                    Global.CANfd.TurnRightLedLightness = int.Parse(tbTurnRightLightnesss.Text);
                    break;

                case 6: // B灯 Left
                    //Global.CANfd.Close();
                    break;

                default:
                    break;
            }
        }
    }
}